package com.lz.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * json格式化
 * Created by Administrator on 2018/8/29 0029.
 */
public class JsonUtil {

    /**
     * gson对象转json
     * @param o 对象
     * @return json
     */
    public static String toJson(Object o){
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(o);
    }
}
